﻿using B.S.Backtrack.Domain.Entities;
using B.S.Backtrack.ErrorCode;
using B.S.Backtrack.Read.API.Application.Command.Acc;
using B.S.Backtrack.Read.API.Application.Command.Cultures;
using B.S.Backtrack.Read.API.Application.Command.Firms;
using B.S.Backtrack.Read.API.Application.Command.Image;
using B.S.Backtrack.Read.API.Application.Command.Proces;
using B.S.Backtrack.Read.API.Application.Command.Product;
using B.S.Backtrack.Read.API.Application.Command.Sla;
using B.S.Backtrack.Read.API.Application.Command.Supp;
using B.S.Backtrack.Read.API.Dtos;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.Backtrack.Read.API.Controllers
{
    /// <summary>
    /// API-读
    /// </summary>
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class ManagementController : ControllerBase
    {
        private readonly IMediator mediator;

        public ManagementController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<Account>> Login([FromQuery] LoginAccountCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询商品名字
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Goods>>> QueryGoods([FromQuery] QueryGoodsCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询产品
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiPaging<ProductsDTO>> QueryProduct([FromQuery] QueryProductCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询详情信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<ProductsDTO>>> QueryInformation([FromQuery] QueryInformationCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 显示图片
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Picture>>> QueryImage([FromQuery] QueryImageCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 反填养殖信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Culture>>> QueryCulture([FromQuery] QueryCultureCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询保健信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Health>>> QueryHealth([FromQuery] QueryHealthCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询养殖企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Firm>>> QueryCulFirm([FromQuery] QueryFirmCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询屠宰信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Slaughter>>> QuerySlaughter([FromQuery] QuerySlaughterCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询屠宰企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Firm>>> QuerySlaFirm([FromQuery] QuerySlaFirmCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询深加工信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Processing>>> QueryProcessing([FromQuery] QueryProcessingCommand request)
        {
            return mediator.Send(request);
        }

        /// <summary>
        /// 查询供应商信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Supplier>>> QuerySupplier([FromQuery] QuerySupplierCommand request)
        {
            return mediator.Send(request);
        }
        /// <summary>
        /// 查询深加工企业信息
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        [HttpGet]
        public Task<ApiResult<List<Firm>>> QueryProcesFirm([FromQuery]QueryProcesFileCommand request)
        {
            return mediator.Send(request);
        }
    }
}
